package com.gzx.plugin.website.mediator.vo;

import cn.hutool.extra.spring.SpringUtil;
import com.fhs.core.trans.anno.Trans;
import com.fhs.core.trans.constant.TransType;
import com.fhs.core.trans.vo.TransPojo;
import com.fhs.trans.service.impl.DictionaryTransService;
import com.gzx.plugin.website.configs.service.GzxWebsiteConfigService;
import com.gzx.plugin.website.mediator.entity.GzxWebsiteMediator;
import io.github.linpeilie.annotations.AutoMapper;
import jakarta.annotation.Resource;
import lombok.Data;

import java.util.Map;

/**
 * @author zjt
 * @description
 * @date 2025/4/27 11:00
 */
@Data
@AutoMapper(target = GzxWebsiteMediator.class)
public class GzxWebsiteMediatorVo implements TransPojo {

    @Resource
    private DictionaryTransService dictionaryTransService;

    /**
     * 主键ID，自增
     */
    private String id;

    /**
     * 姓名
     */
    private String name;

    /**
     * 性别：0-未知，1-男，2-女
     */
    @Trans(type = TransType.DICTIONARY, key = "Sex")
    private String gender;

    /**
     * 民族
     */
    private String ethnic;

    /**
     * 办公地址
     */
    private String officeAddr;

    /**
     * 调委会职务
     */
    private String committeePos;

    /**
     * 调解员编号
     */
    private String mediatorNo;

    /**
     * 负责调解领域
     */
    private String mediationField;

    /**
     * 调解科室
     */
    private String mediationDept;

    /**
     * 联系方式
     */
    private String contact;

    /**
     * 调解中心
     */
    private String configId;

    private String companyName;

    /**
     * 获取翻译map
     *
     * @return 翻译map
     */
    @Override
    public Map<String, Object> getTransMap() {
        Map<String, Object> totalMap = TransPojo.super.getTransMap();
        GzxWebsiteConfigService websiteConfigService = SpringUtil.getBean(GzxWebsiteConfigService.class);
        if (this.configId != null) {
            this.companyName = websiteConfigService.getCompanyDict().get(this.configId);
            totalMap.put("companyName", this.companyName);
        }
        return totalMap;
    }
}
